<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/axios.min.js"></script>
</head>

<body>
  <button id="get">发起get请求</button>

  <script>

    document.querySelector('#get').addEventListener('click', () => {
      axios({
        method: 'GET',//请求类型
        url: 'http://www.liulongbin.top:3006/api/get',//url地址
        params: { name: 'zs', age: 20 },//传入的数据，get写params
      }).then(res => {//回调函数
        console.log(res)
      }).catch(err => {
        console.log(err)
      })

    })

  </script>
</body>

</html>